package com.gzhuxj201.mapper;

import com.gzhuxj201.entity.HomeWork;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface HomeWorkMapper {

    //@Select("select * from homework where tno=#{tno}")
    List<HomeWork> selectByTno(String tno,String courseId);

    @Insert("insert into homework(name,description,tno,teacherName,courseId) " +
            "values(#{name},#{description},#{tno},#{teacherName},#{courseId})")
    int add(HomeWork homeWork);

    @Delete("delete from homework where id=#{id}")
    int deleteById(Integer id);

    @Select("select * from homework where id=#{id}")
    HomeWork selectById(Integer id);

    int update(HomeWork homeWork);

    //@Select("select * from homework where classId=#{classId}")
    List<HomeWork> selectByClassId(Integer startIdx,Integer pageSize,Short classId,String courseId,String name,List<String> cnos);

    @Delete("delete from homework where courseId=#{cno}")
    int deleteByCno(String cno);
}
